#pip install 'camel-ai[all]' --break-system-packages
#pip install "unstructured[all-docs]" --break-system-packages
def run(params:list):
    from camel.agents import KnowledgeGraphAgent
    from camel.loaders import UnstructuredIO
    import os
    from camel.agents import ChatAgent
    from camel.configs import ChatGPTConfig
    from camel.models import ModelFactory
    from camel.toolkits import FunctionTool, MathToolkit, SearchToolkit
    from camel.types import ModelPlatformType, ModelType

    from dotenv import load_dotenv
    load_dotenv()
    openai_model = ModelFactory.create(
        model_platform=ModelPlatformType.OPENAI,
        model_type="Azure-gpt-4o-mini",
        url=os.environ['OPENAI_API_BASE'],
        model_config_dict=ChatGPTConfig(temperature=0.0).as_dict(),
    )
    # Set instance
    
    kg_agent = KnowledgeGraphAgent(openai_model)

    # Set example text input
    text_example = """CAMEL-AI.org is an open-source community dedicated to the study of autonomous and communicative agents. 
    """

    # Create an element from given text
    uio = UnstructuredIO()
    element_example = uio.create_element_from_text(text=text_example)

    # Let KnowledgeGraph Agent extract node and relationship information
    ans_str = kg_agent.run(element_example, parse_graph_elements=False)
    ans_GraphElement = kg_agent.run(element_example, parse_graph_elements=True)

    # Get str output
    print(ans_str)

    # Get GraphElement output
    print(ans_GraphElement)
